<?
include('seguridad.php');
include('bd.php');
Conectar();
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
 <HEAD>
  <TITLE> BideYoday </TITLE>
  <META NAME="Generator" CONTENT="DILAPER">
  <META NAME="Author" CONTENT="Power by Sebastian Costa - Design: Nadia De Cinti">
  <META NAME="Keywords" CONTENT="">
  <META NAME="Description" CONTENT="">
  <link href="../style.css" rel="stylesheet" type="text/css">
  <script src="../js/botonera.js" type="text/javascript"></script>

 </HEAD>

 <BODY topmargin="0">
<center>
<table width="990" height="100%" cellspacing="0" cellpadding="0" class="fondo" border="0">
	<tr>
		<td width="100%" height="100%" align="center" valign="top">
			<table width="100%" height="100%" cellspacing="0" cellpadding="0" border="0">
				<tr>
					<td align="center" valign="top">
<div style="height: 135px"></div>
<!-- contenido -->
<table width="800"  border="0" class="admin_area" cellspacing="0" cellpadding="0">
	<tr bgcolor="#ffffff">
		<td align="right" height="30">
Welcome <?echo $_SESSION['usuario'];?>&nbsp;|&nbsp;<a href="salir.php"><font color="red">Log Out</font></a>&nbsp;&nbsp;
		</td>
	</tr>	
	<tr><td height="3"></td></tr>
	<tr bgcolor="#ffffff">
		<td align="right" height="50">
<?include('menu.php');?>
		</td>
	</tr>	
	<tr><td height="3"></td></tr>
	<tr bgcolor="#ffffff">
		<td align="left" valign="top" height="300"  class="tabla_central">
<div style="margin: 10px">
<?
$result=mysql_query("SELECT * FROM products WHERE id='".$_GET[id]."'");
while($row = mysql_fetch_array($result, MYSQL_ASSOC)){
?>
<b><span class="titulo_admin">Products:&nbsp;&nbsp;<?echo$row[name]?></b>&nbsp;Modle:&nbsp;<b><?echo$row[modle]?></b>&nbsp;&nbsp;|&nbsp;&nbsp;code: <?echo$row[code]?></span></b><br>
<br>
To edit product<br>
<br>
<form name="product_edit" id="product_edit" method="POST" action="acciones/products_promotion_save.php" enctype="multipart/form-data">
<input type="hidden" name="id" value="<?echo$row[id];?>">
<input type="hidden" name="code" value="<?echo$row[code];?>">
<table width="100%" border="0" class="tabla_admin">

	<tr>
		<td align="right" bgcolor="#ffffff" valign="top">
<b>Select Pormotions&nbsp;&nbsp;</b>
		</td>
		<td>
<?
$result_r=mysql_query("SELECT * FROM promotions ORDER BY nombre DESC");
$e='0';
$w_r='0';
$cadena_r=$row[promotions];
while($row_r = mysql_fetch_array($result_r, MYSQL_ASSOC)){
$palabra_r=str_replace(' ', '', $row_r[code]); 
if(eregi("[ z\t\n\r]+".$palabra_r."[ z\t\n\r]+",$cadena_r)){
	$checked.$e='checked';
}else{
    $checked.$e='';
}?>

<input type="checkbox" name="parent[<?echo $w_r;?>]" value="<?echo str_replace(' ', '', $row_r[code]);?>"<?echo$checked.$e?>>&nbsp;<b><?echo$row_r[nombre].'</b><br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;'.$row_r[texto]?><br><br><?	
$e++;$w_r++;}?>
		</td>
	</tr>
	<tr>
		<td colspan="2" bgcolor="#ffffff" align="center">
<input type="submit" value="Add Promotions">
		</td>
	</tr>
</table>
</form>
<?}?>
</div>
<br>
		</td>
	</tr>
</table>
<table width="800" border="0" class="admin_area" cellspacing="0" cellpadding="0">
	<tr>
		<td height="3">

		</td>
	</tr>
	<tr bgcolor="#ffffff">
		<td align="right">
<?include('inc/foot.php');?>
		</td>
	</tr>
</table>
<!-- fin contenido -->
					</td>
				</tr>
			</table>
		</td>
	</tr>
</table>
</center>
 </BODY>
</HTML>
<?Desconectar();?>